"""
验证类
"""

import re

http_expression = re.compile(r'(http|https)://[^\s]*')
number_expression = re.compile(r'^[0-9]*$')


def is_empty(_str):
    """是否为空或None

    :param _str:字符串
    :return:True or False
    """
    if _str == '' or _str is None:
        return True
    else:
        return False


def is_http(str_line):
    r"""验证是否为http链接

    :param str_line:
    :return:
    """
    return bool(re.search(http_expression, str_line))


def is_number(num):
    r"""验证是否为数字

    :param num:数字
    :return:
    """
    return bool(re.search(number_expression, num))
